package com.atguigu.springcloud.alibaba.handler;

import com.alibaba.csp.sentinel.slots.block.BlockException;
import com.atguigu.springcloud.alibaba.exception.MyException;

public class MyFallBackHandler {

    /**
     *  降级方法的要求：
     * 	- 必须是public static修饰的
     * 	- 返回值类型和对应的业务方法是一致
     * 	- 参数列表在和对应业务方法一致的基础上，增加一个BlockException
     * @param blockException
     * @return 降级方法的返回值，我们通常称之为“兜底值”。它会代替原来业务方法的返回值返回给调用者
     */
    public static String processFallbackForTestB(BlockException blockException) throws MyException {
        return "[fall back method process]test b fall back ...";
    }

    public static String resolveFallbackForTestB(Throwable throwable) throws MyException {
        return "[fall back method resolve]test b fall back ...";
    }

}
